package com.lbb.http

import com.lbb.http.call.CallBack
import com.lbb.http.interceptor.ResultInterceptor
import com.lbb.http.provider.OkHttpProvider
import com.lbb.http.provider.OkHttpProviderImpl
import com.lbb.http.provider.Provider
import okhttp3.Interceptor

object HttpUtil : OkHttpProvider , Provider {
    private val provider = OkHttpProviderImpl.instance
    override fun addInterceptor(interceptor: Interceptor) {
        provider.addInterceptor(interceptor)
    }

    override fun get(url: String, map: Map<String, String>?, callback: CallBack<String>?) {
        provider.get(url, map, callback)
    }

    override fun postForm(url: String, map: Map<String, String>?, callback: CallBack<String>?) {
        provider.postForm(url, map, callback)
    }

    override fun postJson(url: String, map: Map<String, String>?, callback: CallBack<String>?) {
        provider.postJson(url, map, callback)
    }

    override fun addHeader(key: String, value: String) {
        provider.addHeader(key,value)
    }

    override fun setHeader(map: Map<String, String>) {
        provider.setHeader(map)
    }

    override fun clearHeader() {
        provider.clearHeader()
    }

    override fun setInterceptor(resultInterceptor: ResultInterceptor) {
        provider.setInterceptor(resultInterceptor)
    }
}